package com.hanoiwiki.manager.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.hanoiwiki.dao.PlacesDAO;
import com.hanoiwiki.exception.DataAccessException;
import com.hanoiwiki.manager.PlacesManager;
import com.hanoiwiki.model.Places;

@Component
@Transactional
public class PlacesManagerImpl extends BaseManagerImpl implements PlacesManager{

	@Autowired
	private PlacesDAO placesDAO;
	
	@Override
	public void save(Places places) {
		try {
			placesDAO.save(places);
		} catch (DataAccessException e) {
			log.error("", e);
		}
	}

	@Override
	public void update(Places places) {
		try {
			placesDAO.update(places);
		} catch (DataAccessException e) {
			log.error("", e);
		}
	}

	@Override
	public Places get(Integer id) {
		try {
			return placesDAO.get(id);
		} catch (DataAccessException e) {
			log.error("", e);
		}
		return null;
	}

	@Override
	public List<Places> getList() {
		try {
			return placesDAO.getList();
		} catch (DataAccessException e) {
			log.error("", e);
		}
		return null;
	}

	@Override
	public void remove(Integer id) {
		try {
			placesDAO.remove(id);
		} catch (DataAccessException e) {
			log.error("", e);
		}
	}

}
